Visibility in C#

Visibility of a class, a method, a variable or a property tells us how the item can be reached. The most common type of visibility is private and public, but in reality many other types of visibility are within C #. Here's a complete list, and although some of them may not look relevant to you, you can always come back to this page and read them:

Public - Members can be reached from anywhere, this is at least restrictive visibility Enums and by default, the interface is publicly visible.

Protected - Members can be obtained from only one class or from that class which is received from this class

Internal - Members can be reached from within the same project

Protected internal - is similar in internal form, except those classes received from classes, they can reach other members as well.

Private - can only be reached by members of the same category. This is the most restrictive visibility, classes and structures are defined by default for personal visibility.

For example, if you have two squares, then 1 private and 1 class of class 1 and class 2 can be used only within 1 class. You can not create a new example of class 1 in class 2, and then you can expect to use your personal members.

If class 2 meets class 1, only non-private members can reach from within class 2